{% extends "admin/base.html" if model_admin.show_nav else "admin/hide_nav.html" %}

{% from 'macros/forms.html' import admin_field %}

{% block body_class %}{{ super() }} model-admin{% endblock %}

{% if model_admin.show_nav %}
	{% block content_title %}{{ model_admin.get_display_name()|fix_underscores }} 管理{% endblock %}
	{% block breadcrumbs %}
	  <li><span class="divider">/</span> <a href="{{ url_for(model_admin.get_url_name('index')) }}">{{ model_admin.get_display_name()|fix_underscores }}</a></li>
	{% endblock %}
{% else %}
{% endif %}

<!-- nav & operate start -->
{% block pre_content %}
<div>
  <ul class="nav nav-tabs">
    <li class="{% block tab_index_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('index')) }}?{{ request.query_string }}">{{ model_admin.get_display_name()|fix_underscores }} ({{ model_admin.get_query().count() }})</a></li>
	{% if 'add' not in model_admin.method_exclude %}
    <li class="{% block tab_add_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('add')) }}">新增</a></li>
	{% endif %}
	{% for op in model_admin.model_op %}
		{% set key=op.__class__.__name__ %}
	<li class="{% if cur_op %}{% if key==cur_op.__class__.__name__ %}active{% endif %}{% endif %}"><a href="{{ url_for(model_admin.get_url_name(key)) }}">{{ op.verbose_name }}</a></li>
	{% endfor %}
	{% if 'export' not in model_admin.method_exclude %}
    <li class="{% block tab_export_class %}{% endblock %}"><a href="{{ url_for(model_admin.get_url_name('export')) }}?{{ request.query_string }}">导出</a></li>
	{% endif %}
    {% block extra_tabs %}{% endblock %}
  </ul>
</div>
{% endblock %}
<!-- nav & operate end -->
